﻿<Window x:Class="Demos.Hashmap.hashmapView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Local="clr-namespace:Demos.Hashmap"
        Title="Estructura del Hashmap" Height="400" Width="600">
    <Window.Resources>
        <DataTemplate DataType="{x:Type Local:Caja}">
            <Grid>
                <Rectangle Stroke="Black" StrokeThickness="1"
                           Height="{Binding Altura}" Width="{Binding Anchura}">
                </Rectangle>
                <Label HorizontalAlignment="Center" Content="{Binding Contenido}"
                       Height="{Binding Altura}" Width="{Binding Anchura}">
                </Label>
            </Grid>
        </DataTemplate>

        <DataTemplate DataType="{x:Type Local:Flecha}">
            <Line X1="{Binding X1}" Y1="{Binding Y1}"
                  X2="{Binding X2}" Y2="{Binding Y2}"
                  Stroke="Black" StrokeThickness="1">
            </Line>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <ItemsControl ItemsSource="{Binding HashMapViewElements}" BorderBrush="Transparent">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Canvas Margin="10"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemContainerStyle>
                    <Style>
                        <Setter Property="Canvas.Left" Value="{Binding X}" />
                        <Setter Property="Canvas.Top" Value="{Binding Y}" />
                    </Style>
                </ItemsControl.ItemContainerStyle>
            </ItemsControl>
        </ScrollViewer>
    </Grid>
</Window>
